/**
 * Project Name:sc-parent-service
 * File Name:CustomerServiceImpl.java
 * Package Name:com.sc.service.impl
 * Date:2018年6月28日下午2:48:53
 * Copyright (c) 2018, bluemobi All Rights Reserved.
 */

package com.sc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sc.mapper.mapperhand.HandcustomerMapper;
import com.sc.pojo.Customer;
import com.sc.probabilitycount.ProbabilityCalculator;
import com.sc.service.CustomerService;

/**
 * Description:   <br/>
 * Date:     2018年6月28日 下午2:48:53 <br/>
 * @author   tianyongxu
 * @version
 * @see
 */
@Service
public class CustomerServiceImpl implements CustomerService{
    //将mapper注入给service
    @Autowired
    private HandcustomerMapper customerMapper;
    
    
    @Override
    public List<Customer> selectCustomers() {
       if (customerMapper.selectCustomers() == null) {
        //交给全局的异常处理
    } 
        return customerMapper.selectCustomers();
    }

    @Override
    public int deleteByPrimaryKey(Integer cid) {
      //这里是肯定是有信息的人的才能删除
      /* if (customerMapper.deleteByPrimaryKey(cid) == null) {
            
       }*/
        return customerMapper.deleteByPrimaryKey(cid);
    }

    @Override
    public Customer selectByPrimaryKey(Integer cid) {
        
        return customerMapper.selectByPrimaryKey(cid);
    }

    /**
     * 计算单个对象概率值的方法
     * */
    @Override
    public float selectBuyHouseProbability(Customer customer) {
        
         return ProbabilityCalculator.calculate(customer);//调用计算机的方法
    }

}

